package com.zzptc.sky.baidudemo.activities;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;

import com.zzptc.sky.baidudemo.R;
import com.zzptc.sky.baidudemo.base.BaseActivity;

public class WelcomeActivity extends BaseActivity {

    private ImageView iv_pic;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.activity_welcome);

        iv_pic = (ImageView) findViewById(R.id.iv_pic);

        ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(iv_pic,"alpha",1.0f,0.1f);
        objectAnimator.setDuration(3000);
        objectAnimator.start();
        objectAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                startActivity(new Intent(WelcomeActivity.this,MainActivity.class));
                finish();
                overridePendingTransition(R.anim.in_from_right,R.anim.out_to_left);
            }
        });

    }

    @Override
    public int getContentLayout() {
        return R.layout.activity_welcome;
    }
}
